﻿@model Nop.Plugin.Payments.PayPalDirect.Models.ConfigurationModel
@{
    Layout = "_ConfigurePlugin";
}
@inject Nop.Core.IWebHelper _webHelper

@await Component.InvokeAsync("StoreScopeConfiguration")
<form asp-controller="PaymentPayPalDirect" asp-action="Configure" method="post">
    <div class="panel-group">
        <div class="panel panel-default">
            <div class="panel-body">
                @Html.Raw(string.Format(T("Plugins.Payments.PayPalDirect.Instructions").Text, $"{_webHelper.GetStoreLocation(true)}Plugins/PaymentPayPalDirect/Webhook", T("Plugins.Payments.PayPalDirect.WebhookCreate").Text))
                <div class="form-group">
                    <div class="col-md-3">
                        <nop-override-store-checkbox asp-for="ClientId_OverrideForStore" asp-input="ClientId" asp-store-scope="@Model.ActiveStoreScopeConfiguration" />
                        <nop-label asp-for="ClientId" />
                    </div>
                    <div class="col-md-9">
                        <nop-editor asp-for="ClientId" />
                        <span asp-validation-for="ClientId"></span>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-3">
                        <nop-override-store-checkbox asp-for="ClientSecret_OverrideForStore" asp-input="ClientSecret" asp-store-scope="@Model.ActiveStoreScopeConfiguration" />
                        <nop-label asp-for="ClientSecret" />
                    </div>
                    <div class="col-md-9">
                        <nop-editor asp-for="ClientSecret" />
                        <span asp-validation-for="ClientSecret"></span>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-3">
                        <nop-label asp-for="WebhookId" />
                    </div>
                    <div class="col-md-9">
                        @if (_webHelper.IsLocalRequest(this.Context.Request))
                        {
                            <nop-editor asp-for="WebhookId" />
                        }
                        else
                        {
                            <div class="input-group">
                                <nop-editor asp-for="WebhookId" />
                                <div class="input-group-btn">
                                    <button type="submit" name="createwebhook" class="btn btn-info">
                                        @Html.Raw(T("Plugins.Payments.PayPalDirect.WebhookCreate"))
                                    </button>
                                </div>
                            </div>
                        }
                        <span asp-validation-for="WebhookId"></span>
                    </div>
                </div>

                <div class="form-group">
                    <div class="col-md-3">
                        <nop-override-store-checkbox asp-for="TransactModeId_OverrideForStore" asp-input="TransactModeId" asp-store-scope="@Model.ActiveStoreScopeConfiguration" />
                        <nop-label asp-for="TransactModeValues" />
                    </div>
                    <div class="col-md-9">
                        <nop-select asp-for="TransactModeId" asp-items="Model.TransactModeValues" />
                        <span asp-validation-for="TransactModeId"></span>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-3">
                        <nop-override-store-checkbox asp-for="UseSandbox_OverrideForStore" asp-input="UseSandbox" asp-store-scope="@Model.ActiveStoreScopeConfiguration" />
                        <nop-label asp-for="UseSandbox" />
                    </div>
                    <div class="col-md-9">
                        <nop-editor asp-for="UseSandbox" />
                        <span asp-validation-for="UseSandbox"></span>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-3">
                        <nop-override-store-checkbox asp-for="PassPurchasedItems_OverrideForStore" asp-input="PassPurchasedItems" asp-store-scope="@Model.ActiveStoreScopeConfiguration" />
                        <nop-label asp-for="PassPurchasedItems" />
                    </div>
                    <div class="col-md-9">
                        <nop-editor asp-for="PassPurchasedItems" />
                        <span asp-validation-for="PassPurchasedItems"></span>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-3">
                        <nop-override-store-checkbox asp-for="AdditionalFee_OverrideForStore" asp-input="AdditionalFee" asp-store-scope="@Model.ActiveStoreScopeConfiguration" />
                        <nop-label asp-for="AdditionalFee" />
                    </div>
                    <div class="col-md-9">
                        <nop-editor asp-for="AdditionalFee" />
                        <span asp-validation-for="AdditionalFee"></span>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-3">
                        <nop-override-store-checkbox asp-for="AdditionalFeePercentage_OverrideForStore" asp-input="AdditionalFeePercentage" asp-store-scope="@Model.ActiveStoreScopeConfiguration" />
                        <nop-label asp-for="AdditionalFeePercentage" />
                    </div>
                    <div class="col-md-9">
                        <nop-editor asp-for="AdditionalFeePercentage" />
                        <span asp-validation-for="AdditionalFeePercentage"></span>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-9 col-md-offset-3">
                        <input type="submit" name="save" class="btn btn-primary" value="@T("Admin.Common.Save")" />
                    </div>
                </div>
            </div>
        </div>
    </div>
</form>